package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

import static java.util.stream.IntStream.*;

/**
 * 描述：生成整形序列的流
 */
public class Ranges {
    public static void main(String[] args) {
        //一般的方式
        int result = 0;
        for (int i = 10; i < 20; i++) {
            result += i;
            System.out.println(result);
        }
        System.out.println("==========================");
        //for-in循环
        result = 0;
        for (int i : range(10, 20).toArray()) {
            result += i;
            System.out.println(result);
        }
        System.out.println("==========================");
        //使用流的形式
        System.out.println(range(10, 20).sum());
    }
}
